<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org/">
<head>
    <meta charset="UTF-8">
    <title>用户编辑</title>
    <base href="http://localhost/resources/back/">

    <script type="text/javascript" src="lib/jquery/1.9.1/jquery.js"></script>
    <script type="text/javascript" src="js/AjaxUtils.js"></script>
    <script type="text/javascript" th:inline="javascript" >

        var pid =0;
    </script>
    <script type="text/javascript">
        $(function () {
            $("#add-but").click(function () {
                var  name=$("#add").val();
                var pid=$("#pid").val();
                // 判断是否勾选了根节点
                if ($("#isRoot").prop("checked")) {
                    pid = -1;
                }
                var param =new Object();
                param.goodsTypeName=name;
                param.goodsTypePid= pid;
                console.info(param);
                 send("back/goodsType/addGoodsType",param,function (data) {
                     if (data.status == "succses") {
                         var index = parent.layer.getFrameIndex(window.name);
                         parent.layer.close(index);
                     }
                 })
            })
        })
    </script>
</head>

<body><input id="pid" name="id" th:value="${id}" hidden>
<input type="checkbox" id="isRoot" value="1">是否根节点<br>
   节点名称:   <input name="goodsTypeName" type="text" id="add">
<button  id="add-but">添加</button>
</body>
</html>